package com.cubeofnine.sugar.service.element;

import org.ksoap2.serialization.SoapObject;

public class ErrorValue {
	private int number = -1;
	private String name = "";
	private String description = "";

	public ErrorValue() {

	}

	public ErrorValue(int number, String name, String description) {
		this.number = number;
		this.name = name;
		this.description = description;
	}

	public ErrorValue(SoapObject object) {
		try {
			this.number = Integer.parseInt(object.getProperty("number")
					.toString(), 10);
		} catch (Exception e) {
			this.number = -1;
		}

		try {
			this.name = object.getProperty("name").toString();
		} catch (Exception e) {
			this.name = null;
		}

		try {
			this.description = object.getProperty("description").toString();
		} catch (Exception e) {
			this.description = null;
		}
	}

	public int getNumber() {
		return number;
	}

	public void setNumber(int number) {
		this.number = number;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Override
	public String toString() {
		return "ErrorValue [number=" + number + ", name=" + name
				+ ", description=" + description + "]";
	}

}
